package com.after.saas.client.service.factory;

import com.after.saas.client.service.RemoteDictService;
import com.after.saas.common.constants.Result;
import com.after.saas.common.model.bo.CoreDictBO;
import com.after.saas.common.utils.ResponseUtil;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Classname DictServiceHystrixFactory
 * @Description TODO
 * @auth after
 * @since 2021/7/20 21:12
 */
@Component
public class DictServiceHystrixFactory implements FallbackFactory<RemoteDictService> {

    @Override
    public RemoteDictService create(Throwable cause) {
        return new RemoteDictService() {
            @Override
            public Result<Boolean> batchSave(List<CoreDictBO> e) {
                return ResponseUtil.FAILURE("字典数据导入失败！" + cause.getMessage());
            }
        };
    }
}
